import 'package:flutter/services.dart';

class AndroidFlutterPlugin {
  factory AndroidFlutterPlugin() => _getInstance();

  static AndroidFlutterPlugin get instance => _getInstance();

  static AndroidFlutterPlugin _instance;

  AndroidFlutterPlugin._internal() {
    //内部初始化
    //init
  }

  static AndroidFlutterPlugin _getInstance() {
    if (_instance == null) {
      _instance = new AndroidFlutterPlugin._internal();
    }
    return _instance;
  }

  //这里初始化通道,里面存放一个name，用来和Android进行交互
  static const channel = MethodChannel('android_flutter_plugin');

  void showLongToast(String message) {
    channel.invokeListMethod('showLongToast', {'message': message});
  }
  void showShortToast(String message) {
    channel.invokeListMethod('showShortToast', {'message': message});
  }
  Future<dynamic> openGps() async {
    channel.invokeListMethod('openGps');
  }
}
